/****************************************************************************
** @brief context
****************************************************************************/

#ifndef GUN_H
#define GUN_H

class Status;

class Gun
{
public:
    explicit Gun(int no);
    ~Gun();

    ///
    /// \brief Process
    ///
    void Process();

    ///
    /// \brief state
    /// \return
    ///
    int state();

    int gun_number() const
    {
        return gun_number_;
    }

    int start_timeout() const
    {
        return start_timeout_;
    }

    void set_start_timeout(int value)
    {
        start_timeout_ = value;
    }

    int start_time() const
    {
        return start_time_;
    }

    void set_start_time(int value)
    {
        start_time_ = value;
    }

    int stop_timeout() const
    {
        return stop_timeout_;
    }

    void set_stop_timeout(int value)
    {
        stop_timeout_ = value;
    }

    int stop_time() const
    {
        return stop_time_;
    }

    void set_stop_time(int value)
    {
        stop_time_ = value;
    }

    int charge_time() const
    {
        return charge_time_;
    }

    void set_charge_time(int value)
    {
        charge_time_ = value;
    }

    int charge_elect() const
    {
        return charge_elect_;
    }

    void set_charge_elect(int value)
    {
        charge_elect_ = value;
    }

    char *card_number(void);
    void set_card_number(char *data, int len);

protected:

private:
    friend class Status;

    ///
    /// \brief ChangeState
    /// \param s
    ///
    void ChangeState(Status *s);

    Status *state_ = nullptr;

    int gun_number_ = 0;
    int start_timeout_ = 0;
    int start_time_ = 0;
    int stop_timeout_ = 0;
    int stop_time_ = 0;
    int charge_time_ = 0;
    int charge_elect_ = 0;
    char card_number_[16] = {0};
};

#endif // GUN_H
